package pta07;

class Account1{
	private int balance;
	
	public void setBalance(int balance) {
		this.balance = balance;
	}

	
	public  synchronized void deposit(int money){
		setBalance(balance+money);
		notify();
	}
	
	public  synchronized void withdraw(int money) {	
		while(balance<=0){
			try{
				wait();
			}catch(InterruptedException e){
				e.printStackTrace();
			} 
			
		}
		balance = balance - money;
	
	}
}
public class Hanshu5 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
